﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VersionComparer.DataModel;

namespace VersionComparer
{
    public partial class FileListInsertForm : Form
    {
        #region constructors
        public FileListInsertForm()
        {
            InitializeComponent();
            Text = Resources.Resources.FileListInsertFormCaption;
            StartPosition = FormStartPosition.CenterScreen;
            
        }
        #endregion constructors

        #region events
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Enter)
            {
                //btOK_Click(this, new EventArgs());
                //return true;
            }
            if (keyData == Keys.Escape)
            {
                btCancel_Click(this, new EventArgs());
                return true;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
        private void btOK_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.OK;
            fileListInsertControl1.Close();
            Close();
        }
        protected override void OnLoad(EventArgs e)
        {
            Icon = Owner.Icon;
            base.OnLoad(e);
        }
        private void btCancel_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
            Close();
        }
        #endregion events

        #region properties
        public ItemNamePairList FileList
        {
            get
            {
                return fileListInsertControl1.FileList;
            }
            set
            {
                if ( value != null )
                    fileListInsertControl1.FileList = value.Clone();
            }
        }
        #endregion properties

    }
}
